function CloseControl(router, route, map) {
    this._router = router;
    this._route = route;

    this.map = map;
    this.defaultAnchor = 1;
    this.defaultOffset = new BMap.Size(20, 20);
}

CloseControl.prototype = new BMap.Control();

CloseControl.prototype.initialize = function() {
    let div = document.createElement("div");
    div.title = "退出全景";
    div.className = "BMap_noprint anchorTR";
    div.style.width = "49px";
    div.style.height = "51px";
    div.style.color = "rgb(86, 86, 86)";
    div.style.background = "url('http://api.map.baidu.com/images/st-control.png') 0px 0px no-repeat";
    div.style.position = "absolute";
    div.style.cursor = "pointer";
    div.style.fontFamily = "arial, sans-serif";
    div.style.fontSize = "13px";
    div.style.textAlign = "center";
    div.style.boxShadow = "rgba(0, 0, 0, 0.3) 0px 0px 3px";
    div.style.zIndex = 10;
    div.style.msTextSizeAdjust = "none";
    div.style.bottom = "auto";
    div.style.right = "20px";
    div.style.top = "20px";
    div.style.left = "auto";

    let span = document.createElement("span");
    span.style.position = "relative";
    span.style.top = "33px";
    span.innerText = "退出";

    div.appendChild(span);
    div.onclick = () => {
        if (this._route.name !== "EmptyComponent") {
            this._router.push({ name: "EmptyComponent" });
        }
    };

    this.map.getContainer().appendChild(div);
    return div;
};

export default CloseControl;
